//Name:
//Purpose:
//Author: wjy
//Date: 2022-01-25 10:42:12
//From:

#include <stdio.h>
#include <stdlib.h>

int GCD(int m, int n);

int main(void)
{
    int m, n, temp;
    printf("Enter a fraction: ");
    scanf("%d/%d", &n, &m);
    temp = GCD(m, n);
    printf("In lowest term: %d/%d\n", n / temp, m / temp);
    system("pause");
    return 0;
}

int GCD(int m, int n)
{
    int temp;
    while (1)
    {
        if (n == 0)
        {
            break;
        }
        else
        {
            temp = m % n;
            m = n;
            n = temp;
        }
    }
    return m;
}